* this file has been revised for the RR round at JLEO
* it now displays confidence intervals, and reports separately regressions with only a year dummy (not judge type dummies) & robustness checks also including dropping obs.

clear all

use forum a_location sympathy year judgetype cap lexloci correct Q4 Q6 using alldata.dta, clear
recode lexloci cap correct (0 = -1) // this ensures that the three variables are EXACTLY equivalent: see footnote in paper's section 3.4 explaining this

local esttab_options `"replace nobase order(forum a_location sympathy) b(2) ci(2) star(* .1 ** .05 *** .01)"'

program threeregressions
	foreach depvar of varlist cap  correct lexloci {
		qui: _eststo: reg `depvar' c.f##c.a##c.s `1'
		}
	end

*** table 5 itself
threeregressions
esttab using analysis_output/regressions.html, `esttab_options'

*** confidence interval for law-following under the rule in model 2
estimates restore est2
codebook forum // WY = -1, SD = 1
lincom (_cons - forum)/2 // WY. The estimated average law-following is this plus .5, but the null is that it's .5, so don't add here
lincom (_cons + forum)/2 // SD. Id.


*** robustness checks *******************
estimates drop _all
foreach modification in ", vce(robust)" "i.year" "i.judge i.year" `"if Q4_realistic!="No""' `"if Q6_prior!="Yes""' `"if (Q4_realistic!="No" | Q6_prior!="Yes")"' {
	threeregressions `"`modification'"'
}
esttab using analysis_output/regressions_robustness.html, `esttab_options'

* specifically: confirm that bias against cap persists with year dummy:
reg cap c.f##c.a##c.s i.year
test _cons 2018.year // sort of, at p=.079